# 导包
import requests
import config


# 创建接口类
class HomeAPI:
    # 初始化
    # url_banner = config.BATH_URL + "/banner/1"    HomeAPI.url_banner
    def __init__(self):
        self.url_banner = config.BATH_URL + "/banner/1"
        self.url_theme = config.BATH_URL + "/theme?ids=1,2,3"
        self.url_recent = config.BATH_URL + "/product/recent"

    # 获取轮播图
    def banner(self):
        return requests.get(url=self.url_banner)

    # 获取专题栏位
    def theme(self):
        return requests.get(url=self.url_theme)

    # 获取最近新品
    def recent(self):
        return requests.get(url=self.url_recent)


if __name__ == '__main__':
    # 获取轮播图
    print(HomeAPI().banner().json())
    print("-" * 100)
    # 获取专题栏位
    print(HomeAPI().theme().json())
    print("-" * 100)
    # 获取最近新品
    print(HomeAPI().recent().json())
